package com.ruoyi.novel.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.common.utils.DateUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.novel.mapper.VideoMapper;
import com.ruoyi.novel.domain.Video;
import com.ruoyi.novel.service.IVideoService;

/**
 * 视频信息Service业务层处理
 *
 * @author 张三
 * @date 2025-04-18
 */
@Service
public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements IVideoService
{
    @Autowired
    private VideoMapper videoMapper;

    /**
     * 查询视频信息
     *
     * @param id 视频信息主键
     * @return 视频信息
     */
    @Override
    public Video selectVideoById(Integer id)
    {
        return videoMapper.selectVideoById(id);
    }

    /**
     * 查询视频信息列表
     *
     * @param video 视频信息
     * @return 视频信息
     */
    @Override
    public List<Video> selectVideoList(Video video)
    {
        return videoMapper.selectVideoList(video);
    }

    /**
     * 新增视频信息
     *
     * @param video 视频信息
     * @return 结果
     */
    @Override
    public int insertVideo(Video video)
    {
        video.setCreateTime(DateUtils.getNowDate());
        return videoMapper.insertVideo(video);
    }

    /**
     * 修改视频信息
     *
     * @param video 视频信息
     * @return 结果
     */
    @Override
    public int updateVideo(Video video)
    {
        video.setUpdateTime(DateUtils.getNowDate());
        return videoMapper.updateVideo(video);
    }

    /**
     * 批量删除视频信息
     *
     * @param ids 需要删除的视频信息主键
     * @return 结果
     */
    @Override
    public int deleteVideoByIds(Integer[] ids)
    {
        return videoMapper.deleteVideoByIds(ids);
    }

    /**
     * 删除视频信息信息
     *
     * @param id 视频信息主键
     * @return 结果
     */
    @Override
    public int deleteVideoById(Integer id)
    {
        return videoMapper.deleteVideoById(id);
    }

    @Override
    public IPage<Video> getUserVideoList(IPage<Video> page, QueryWrapper<Video> queryWrapper) {
        return videoMapper.getUserVideoList(page, queryWrapper);
    }

    @Override
    public IPage<Video> getOrderVideoList(IPage<Video> page, QueryWrapper<Video> queryWrapper) {
        return videoMapper.getOrderVideoList(page, queryWrapper);
    }
}
